//
//  TodayCustomCollectionViewCell.m
//  SYiDaiy
//
//  Created by dllo on 16/8/29.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TodayCustomCollectionViewCell.h"
#import "UIView+Label.h"
#import "UIView+ImageView.h"
#import "TAMacro.h"
#import "Masonry.h"

@implementation TodayCustomCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        
        _monthLabel = [UILabel new];
        _monthLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_monthLabel];
        _monthLabel.numberOfLines = 0;
        _monthLabel.textColor = [UIColor blackColor];
        _monthLabel.alpha = 0.5;
        
        _titieLabel = [UILabel new];
        [self.contentView addSubview:_titieLabel];
        
        _dayLabel = [UILabel new];
        _dayLabel.font = [UIFont systemFontOfSize:17];
        [self.contentView addSubview:_dayLabel];
        
        
        _sourceLabel = [UILabel new];
        _sourceLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_sourceLabel];
        _sourceLabel.alpha = 0.5;
        _mainImageView = [UIImageView new];
        [self.contentView addSubview:_mainImageView];
        
        _playButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_playButton setImage:[UIImage imageNamed:@"ButtonPlayVideo"] forState:UIControlStateNormal];
    }
    return self;
}

- (void)layoutSubviews
{
    CGFloat labelWidth = SCREEN_WIDTH / 375 * 50;
    CGFloat labelHeight = labelWidth * 3 / 5;


    [_mainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(SCREEN_HEIGHT - 200);
    }];
    
    [_dayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.width.mas_equalTo(labelWidth);
        make.height.mas_equalTo(labelHeight);
        make.top.mas_equalTo(_mainImageView.mas_bottom).mas_equalTo(10);
    }];

    [_monthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_dayLabel.mas_left);
        make.top.mas_equalTo(_dayLabel.mas_bottom).mas_equalTo(0);
        make.width.mas_equalTo(_dayLabel.mas_width);
        make.height.mas_equalTo(_dayLabel.mas_height);
    }];

    [_titieLabel mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_mainImageView.mas_bottom).mas_equalTo(10);
        make.left.mas_equalTo(_dayLabel.mas_right).mas_equalTo(10);
        make.right.mas_equalTo(10);
        make.height.mas_equalTo(_dayLabel.mas_height);
    }];
    
    

    [_sourceLabel mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_titieLabel.mas_bottom).mas_equalTo(0);
        make.left.mas_equalTo(_monthLabel.mas_right).mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(labelHeight);
    }];

//    [_playButton mas_updateConstraints:^(MASConstraintMaker *make) {
//                make.width.height.mas_equalTo(50);
//                make.centerX.mas_equalTo(1);
//                make.centerY.mas_equalTo(0.3);
//    }];
    _playButton.frame = CGRectMake(150, 300, 50, 50);
}





- (void)awakeFromNib {
    // Initialization code
}

@end
